home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Epic Collection 3
/
Epic Collection 3, The (1997)(Epic Marketing)[!].iso
/
internet
/
ums
/
ums11.6
/
rexx
/
showgroups.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-09-08
|
3KB
|
127 lines
/* ------------------------------------------------------------------------
:Program. ShowGroups.rexx
:Contents. shows all groups in UMS' messagebase
:Author. Kai Bolay [kai]
:Address. Snail Mail: EMail:
:Address. Hoffmannstraße 168 UUCP: kai@amokle.stgt.sub.org
:Address. D-71229 Leonberg FIDO: 2:2407/106.3
:History. v1.0 [kai] 23-Sep-93
:History. v1.2 [kai] 29-Sep-93 added MakeFlags()
:History. v1.3 [hg] 16-Jan-94 improofed argument parsing,
:History. added option NoUpdate
:History. v1.4 [hG] 23-Jan-94 uses UMSInit.rexx 1.1 and
:History. hgRexxSupport.library
:History. v2.0 [kai] 21-Dec-94 adapted to UMS v11
:Version. $VER: ShowGroups.rexx 1.4 (21.12.94)
:Copyright. Public Domain
:Language. ARexx
:Translator. RexxMast
------------------------------------------------------------------------ */
options results
RC = 0
signal on BREAK_C
signal on BREAK_D
signal on BREAK_E
signal on BREAK_F
signal on ERROR
signal on HALT
signal on IOERR
signal on SYNTAX
/*** Init ***/
call addlib("rexxdossupport.library", 0, -30)
call addlib("ums.library", 0, -210, 11)
call UMSInitConsts()
/*** Arguments ***/
ProgramName = "ShowGroups";
ArgsTemplate = "NAME,PASSWORD,SERVER/K";
args.SERVER = ""
args.PASSWORD = ""
parse arg arguments
if strip(arguments) = '?' then do
call writech(STDOUT, ArgsTemplate || ': ')
arguments = readln(STDIN)
end; else nop
if ~ReadArgs(arguments,ArgsTemplate,"args.") then do
say Fault(RC, ProgramName)
exit 10
end; else nop
/*** Login ***/
account = UMSLogin(args.name, args.password, args.server)
if account = 0 then do
say "unable to login."
exit 10
end
/*** Do the magic ***/
/* clear local flag 0 on all messages */
res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(), UMSMakeFlags(0),,, "LOCAL", UMSMakeFlags(), UMSMakeFlags())
say "you have" res "messages in your message base"
/* set local flag 0 on all readable messages */
res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(),,, "USER", UMSMakeFlags(UMSUSTAT_ReadAccess), UMSMakeFlags())
say "you can't read" res "messages"
last = 0
do forever
/* find next message with flag 0 set */
last = UMSSearchFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(), last)
if last = 0 then leave
drop msg. /* _IMPORTANT_ */
if ~ UMSReadMsgField(account, last, msg., UMSCODE_Group, TRUE) then do
call CheckErr
end
if symbol("msg." || UMSCode_Group) ~= "VAR" then do
/* clear local flag 0 on all private messages */
res = UMSSelectField(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(),,, UMSCODE_Group, "", true)
say res "private messages"
end; else do
/* clear local flag 0 on all messages belonging to this group */
res = UMSSelectField(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(),,, UMSCODE_Group, msg.UMSCODE_Group, true)
say res "messages in" msg.UMSCode_Group
end
end
/*** Final cleanup ***/
BREAK_C:
BREAK_D:
BREAK_E:
BREAK_F:
ERROR:
HALT:
IOERR:
SYNTAX:
IF RC ~= 0 THEN DO
SAY "Error: " rc errortext(rc) "Line" sigl
END
/*** Logout ***/
if account ~= 0 then do
call UMSLogout(account)
account = 0
end
exit
/*** Support ***/
CheckErr: procedure expose account
err = UMSErrNum(account)
if err ~= 0 then do
say "UMS Error #" || err || ": " || UMSErrTxt(account)
end
return